<?php


abstract class BaseSpecialEvent extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $conference_id;


	
	protected $special_code;


	
	protected $name;


	
	protected $description;


	
	protected $time_start;


	
	protected $time_end;


	
	protected $fee;


	
	protected $max_enroll;


	
	protected $cur_enroll;


	
	protected $created_at;

	
	protected $aConference;

	
	protected $collCategorySpecialEvents;

	
	protected $lastCategorySpecialEventCriteria = null;

	
	protected $collSpeakerSpecialEvents;

	
	protected $lastSpeakerSpecialEventCriteria = null;

	
	protected $collSpecialEventRegistrations;

	
	protected $lastSpecialEventRegistrationCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getConferenceId()
	{

		return $this->conference_id;
	}

	
	public function getSpecialCode()
	{

		return $this->special_code;
	}

	
	public function getName()
	{

		return $this->name;
	}

	
	public function getDescription()
	{

		return $this->description;
	}

	
	public function getTimeStart($format = 'Y-m-d H:i:s')
	{

		if ($this->time_start === null || $this->time_start === '') {
			return null;
		} elseif (!is_int($this->time_start)) {
						$ts = strtotime($this->time_start);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [time_start] as date/time value: " . var_export($this->time_start, true));
			}
		} else {
			$ts = $this->time_start;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getTimeEnd($format = 'Y-m-d H:i:s')
	{

		if ($this->time_end === null || $this->time_end === '') {
			return null;
		} elseif (!is_int($this->time_end)) {
						$ts = strtotime($this->time_end);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [time_end] as date/time value: " . var_export($this->time_end, true));
			}
		} else {
			$ts = $this->time_end;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getFee()
	{

		return $this->fee;
	}

	
	public function getMaxEnroll()
	{

		return $this->max_enroll;
	}

	
	public function getCurEnroll()
	{

		return $this->cur_enroll;
	}

	
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
						$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function setId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = SpecialEventPeer::ID;
		}

	} 
	
	public function setConferenceId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->conference_id !== $v) {
			$this->conference_id = $v;
			$this->modifiedColumns[] = SpecialEventPeer::CONFERENCE_ID;
		}

		if ($this->aConference !== null && $this->aConference->getId() !== $v) {
			$this->aConference = null;
		}

	} 
	
	public function setSpecialCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->special_code !== $v) {
			$this->special_code = $v;
			$this->modifiedColumns[] = SpecialEventPeer::SPECIAL_CODE;
		}

	} 
	
	public function setName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->name !== $v) {
			$this->name = $v;
			$this->modifiedColumns[] = SpecialEventPeer::NAME;
		}

	} 
	
	public function setDescription($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->description !== $v) {
			$this->description = $v;
			$this->modifiedColumns[] = SpecialEventPeer::DESCRIPTION;
		}

	} 
	
	public function setTimeStart($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [time_start] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->time_start !== $ts) {
			$this->time_start = $ts;
			$this->modifiedColumns[] = SpecialEventPeer::TIME_START;
		}

	} 
	
	public function setTimeEnd($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [time_end] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->time_end !== $ts) {
			$this->time_end = $ts;
			$this->modifiedColumns[] = SpecialEventPeer::TIME_END;
		}

	} 
	
	public function setFee($v)
	{

		if ($this->fee !== $v) {
			$this->fee = $v;
			$this->modifiedColumns[] = SpecialEventPeer::FEE;
		}

	} 
	
	public function setMaxEnroll($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->max_enroll !== $v) {
			$this->max_enroll = $v;
			$this->modifiedColumns[] = SpecialEventPeer::MAX_ENROLL;
		}

	} 
	
	public function setCurEnroll($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->cur_enroll !== $v) {
			$this->cur_enroll = $v;
			$this->modifiedColumns[] = SpecialEventPeer::CUR_ENROLL;
		}

	} 
	
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = SpecialEventPeer::CREATED_AT;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->conference_id = $rs->getInt($startcol + 1);

			$this->special_code = $rs->getString($startcol + 2);

			$this->name = $rs->getString($startcol + 3);

			$this->description = $rs->getString($startcol + 4);

			$this->time_start = $rs->getTimestamp($startcol + 5, null);

			$this->time_end = $rs->getTimestamp($startcol + 6, null);

			$this->fee = $rs->getFloat($startcol + 7);

			$this->max_enroll = $rs->getInt($startcol + 8);

			$this->cur_enroll = $rs->getInt($startcol + 9);

			$this->created_at = $rs->getTimestamp($startcol + 10, null);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 11; 
		} catch (Exception $e) {
			throw new PropelException("Error populating SpecialEvent object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(SpecialEventPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			SpecialEventPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isNew() && !$this->isColumnModified(SpecialEventPeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(SpecialEventPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


												
			if ($this->aConference !== null) {
				if ($this->aConference->isModified()) {
					$affectedRows += $this->aConference->save($con);
				}
				$this->setConference($this->aConference);
			}


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = SpecialEventPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += SpecialEventPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collCategorySpecialEvents !== null) {
				foreach($this->collCategorySpecialEvents as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collSpeakerSpecialEvents !== null) {
				foreach($this->collSpeakerSpecialEvents as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collSpecialEventRegistrations !== null) {
				foreach($this->collSpecialEventRegistrations as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aConference !== null) {
				if (!$this->aConference->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aConference->getValidationFailures());
				}
			}


			if (($retval = SpecialEventPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collCategorySpecialEvents !== null) {
					foreach($this->collCategorySpecialEvents as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collSpeakerSpecialEvents !== null) {
					foreach($this->collSpeakerSpecialEvents as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collSpecialEventRegistrations !== null) {
					foreach($this->collSpecialEventRegistrations as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = SpecialEventPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getConferenceId();
				break;
			case 2:
				return $this->getSpecialCode();
				break;
			case 3:
				return $this->getName();
				break;
			case 4:
				return $this->getDescription();
				break;
			case 5:
				return $this->getTimeStart();
				break;
			case 6:
				return $this->getTimeEnd();
				break;
			case 7:
				return $this->getFee();
				break;
			case 8:
				return $this->getMaxEnroll();
				break;
			case 9:
				return $this->getCurEnroll();
				break;
			case 10:
				return $this->getCreatedAt();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = SpecialEventPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getConferenceId(),
			$keys[2] => $this->getSpecialCode(),
			$keys[3] => $this->getName(),
			$keys[4] => $this->getDescription(),
			$keys[5] => $this->getTimeStart(),
			$keys[6] => $this->getTimeEnd(),
			$keys[7] => $this->getFee(),
			$keys[8] => $this->getMaxEnroll(),
			$keys[9] => $this->getCurEnroll(),
			$keys[10] => $this->getCreatedAt(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = SpecialEventPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setConferenceId($value);
				break;
			case 2:
				$this->setSpecialCode($value);
				break;
			case 3:
				$this->setName($value);
				break;
			case 4:
				$this->setDescription($value);
				break;
			case 5:
				$this->setTimeStart($value);
				break;
			case 6:
				$this->setTimeEnd($value);
				break;
			case 7:
				$this->setFee($value);
				break;
			case 8:
				$this->setMaxEnroll($value);
				break;
			case 9:
				$this->setCurEnroll($value);
				break;
			case 10:
				$this->setCreatedAt($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = SpecialEventPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setConferenceId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setSpecialCode($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setName($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setDescription($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setTimeStart($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setTimeEnd($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setFee($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setMaxEnroll($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setCurEnroll($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setCreatedAt($arr[$keys[10]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(SpecialEventPeer::DATABASE_NAME);

		if ($this->isColumnModified(SpecialEventPeer::ID)) $criteria->add(SpecialEventPeer::ID, $this->id);
		if ($this->isColumnModified(SpecialEventPeer::CONFERENCE_ID)) $criteria->add(SpecialEventPeer::CONFERENCE_ID, $this->conference_id);
		if ($this->isColumnModified(SpecialEventPeer::SPECIAL_CODE)) $criteria->add(SpecialEventPeer::SPECIAL_CODE, $this->special_code);
		if ($this->isColumnModified(SpecialEventPeer::NAME)) $criteria->add(SpecialEventPeer::NAME, $this->name);
		if ($this->isColumnModified(SpecialEventPeer::DESCRIPTION)) $criteria->add(SpecialEventPeer::DESCRIPTION, $this->description);
		if ($this->isColumnModified(SpecialEventPeer::TIME_START)) $criteria->add(SpecialEventPeer::TIME_START, $this->time_start);
		if ($this->isColumnModified(SpecialEventPeer::TIME_END)) $criteria->add(SpecialEventPeer::TIME_END, $this->time_end);
		if ($this->isColumnModified(SpecialEventPeer::FEE)) $criteria->add(SpecialEventPeer::FEE, $this->fee);
		if ($this->isColumnModified(SpecialEventPeer::MAX_ENROLL)) $criteria->add(SpecialEventPeer::MAX_ENROLL, $this->max_enroll);
		if ($this->isColumnModified(SpecialEventPeer::CUR_ENROLL)) $criteria->add(SpecialEventPeer::CUR_ENROLL, $this->cur_enroll);
		if ($this->isColumnModified(SpecialEventPeer::CREATED_AT)) $criteria->add(SpecialEventPeer::CREATED_AT, $this->created_at);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(SpecialEventPeer::DATABASE_NAME);

		$criteria->add(SpecialEventPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setConferenceId($this->conference_id);

		$copyObj->setSpecialCode($this->special_code);

		$copyObj->setName($this->name);

		$copyObj->setDescription($this->description);

		$copyObj->setTimeStart($this->time_start);

		$copyObj->setTimeEnd($this->time_end);

		$copyObj->setFee($this->fee);

		$copyObj->setMaxEnroll($this->max_enroll);

		$copyObj->setCurEnroll($this->cur_enroll);

		$copyObj->setCreatedAt($this->created_at);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getCategorySpecialEvents() as $relObj) {
				$copyObj->addCategorySpecialEvent($relObj->copy($deepCopy));
			}

			foreach($this->getSpeakerSpecialEvents() as $relObj) {
				$copyObj->addSpeakerSpecialEvent($relObj->copy($deepCopy));
			}

			foreach($this->getSpecialEventRegistrations() as $relObj) {
				$copyObj->addSpecialEventRegistration($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new SpecialEventPeer();
		}
		return self::$peer;
	}

	
	public function setConference($v)
	{


		if ($v === null) {
			$this->setConferenceId(NULL);
		} else {
			$this->setConferenceId($v->getId());
		}


		$this->aConference = $v;
	}


	
	public function getConference($con = null)
	{
		if ($this->aConference === null && ($this->conference_id !== null)) {
						include_once 'lib/model/om/BaseConferencePeer.php';

			$this->aConference = ConferencePeer::retrieveByPK($this->conference_id, $con);

			
		}
		return $this->aConference;
	}

	
	public function initCategorySpecialEvents()
	{
		if ($this->collCategorySpecialEvents === null) {
			$this->collCategorySpecialEvents = array();
		}
	}

	
	public function getCategorySpecialEvents($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseCategorySpecialEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCategorySpecialEvents === null) {
			if ($this->isNew()) {
			   $this->collCategorySpecialEvents = array();
			} else {

				$criteria->add(CategorySpecialEventPeer::SPECIALEVENT_ID, $this->getId());

				CategorySpecialEventPeer::addSelectColumns($criteria);
				$this->collCategorySpecialEvents = CategorySpecialEventPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(CategorySpecialEventPeer::SPECIALEVENT_ID, $this->getId());

				CategorySpecialEventPeer::addSelectColumns($criteria);
				if (!isset($this->lastCategorySpecialEventCriteria) || !$this->lastCategorySpecialEventCriteria->equals($criteria)) {
					$this->collCategorySpecialEvents = CategorySpecialEventPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastCategorySpecialEventCriteria = $criteria;
		return $this->collCategorySpecialEvents;
	}

	
	public function countCategorySpecialEvents($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseCategorySpecialEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(CategorySpecialEventPeer::SPECIALEVENT_ID, $this->getId());

		return CategorySpecialEventPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addCategorySpecialEvent(CategorySpecialEvent $l)
	{
		$this->collCategorySpecialEvents[] = $l;
		$l->setSpecialEvent($this);
	}


	
	public function getCategorySpecialEventsJoinCategory($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseCategorySpecialEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCategorySpecialEvents === null) {
			if ($this->isNew()) {
				$this->collCategorySpecialEvents = array();
			} else {

				$criteria->add(CategorySpecialEventPeer::SPECIALEVENT_ID, $this->getId());

				$this->collCategorySpecialEvents = CategorySpecialEventPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
									
			$criteria->add(CategorySpecialEventPeer::SPECIALEVENT_ID, $this->getId());

			if (!isset($this->lastCategorySpecialEventCriteria) || !$this->lastCategorySpecialEventCriteria->equals($criteria)) {
				$this->collCategorySpecialEvents = CategorySpecialEventPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastCategorySpecialEventCriteria = $criteria;

		return $this->collCategorySpecialEvents;
	}

	
	public function initSpeakerSpecialEvents()
	{
		if ($this->collSpeakerSpecialEvents === null) {
			$this->collSpeakerSpecialEvents = array();
		}
	}

	
	public function getSpeakerSpecialEvents($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSpeakerSpecialEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSpeakerSpecialEvents === null) {
			if ($this->isNew()) {
			   $this->collSpeakerSpecialEvents = array();
			} else {

				$criteria->add(SpeakerSpecialEventPeer::SPECIALEVENT_ID, $this->getId());

				SpeakerSpecialEventPeer::addSelectColumns($criteria);
				$this->collSpeakerSpecialEvents = SpeakerSpecialEventPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(SpeakerSpecialEventPeer::SPECIALEVENT_ID, $this->getId());

				SpeakerSpecialEventPeer::addSelectColumns($criteria);
				if (!isset($this->lastSpeakerSpecialEventCriteria) || !$this->lastSpeakerSpecialEventCriteria->equals($criteria)) {
					$this->collSpeakerSpecialEvents = SpeakerSpecialEventPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastSpeakerSpecialEventCriteria = $criteria;
		return $this->collSpeakerSpecialEvents;
	}

	
	public function countSpeakerSpecialEvents($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseSpeakerSpecialEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(SpeakerSpecialEventPeer::SPECIALEVENT_ID, $this->getId());

		return SpeakerSpecialEventPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addSpeakerSpecialEvent(SpeakerSpecialEvent $l)
	{
		$this->collSpeakerSpecialEvents[] = $l;
		$l->setSpecialEvent($this);
	}


	
	public function getSpeakerSpecialEventsJoinSpeaker($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSpeakerSpecialEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSpeakerSpecialEvents === null) {
			if ($this->isNew()) {
				$this->collSpeakerSpecialEvents = array();
			} else {

				$criteria->add(SpeakerSpecialEventPeer::SPECIALEVENT_ID, $this->getId());

				$this->collSpeakerSpecialEvents = SpeakerSpecialEventPeer::doSelectJoinSpeaker($criteria, $con);
			}
		} else {
									
			$criteria->add(SpeakerSpecialEventPeer::SPECIALEVENT_ID, $this->getId());

			if (!isset($this->lastSpeakerSpecialEventCriteria) || !$this->lastSpeakerSpecialEventCriteria->equals($criteria)) {
				$this->collSpeakerSpecialEvents = SpeakerSpecialEventPeer::doSelectJoinSpeaker($criteria, $con);
			}
		}
		$this->lastSpeakerSpecialEventCriteria = $criteria;

		return $this->collSpeakerSpecialEvents;
	}

	
	public function initSpecialEventRegistrations()
	{
		if ($this->collSpecialEventRegistrations === null) {
			$this->collSpecialEventRegistrations = array();
		}
	}

	
	public function getSpecialEventRegistrations($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSpecialEventRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSpecialEventRegistrations === null) {
			if ($this->isNew()) {
			   $this->collSpecialEventRegistrations = array();
			} else {

				$criteria->add(SpecialEventRegistrationPeer::SPECIALEVENT_ID, $this->getId());

				SpecialEventRegistrationPeer::addSelectColumns($criteria);
				$this->collSpecialEventRegistrations = SpecialEventRegistrationPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(SpecialEventRegistrationPeer::SPECIALEVENT_ID, $this->getId());

				SpecialEventRegistrationPeer::addSelectColumns($criteria);
				if (!isset($this->lastSpecialEventRegistrationCriteria) || !$this->lastSpecialEventRegistrationCriteria->equals($criteria)) {
					$this->collSpecialEventRegistrations = SpecialEventRegistrationPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastSpecialEventRegistrationCriteria = $criteria;
		return $this->collSpecialEventRegistrations;
	}

	
	public function countSpecialEventRegistrations($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseSpecialEventRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(SpecialEventRegistrationPeer::SPECIALEVENT_ID, $this->getId());

		return SpecialEventRegistrationPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addSpecialEventRegistration(SpecialEventRegistration $l)
	{
		$this->collSpecialEventRegistrations[] = $l;
		$l->setSpecialEvent($this);
	}


	
	public function getSpecialEventRegistrationsJoinRegistration($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseSpecialEventRegistrationPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collSpecialEventRegistrations === null) {
			if ($this->isNew()) {
				$this->collSpecialEventRegistrations = array();
			} else {

				$criteria->add(SpecialEventRegistrationPeer::SPECIALEVENT_ID, $this->getId());

				$this->collSpecialEventRegistrations = SpecialEventRegistrationPeer::doSelectJoinRegistration($criteria, $con);
			}
		} else {
									
			$criteria->add(SpecialEventRegistrationPeer::SPECIALEVENT_ID, $this->getId());

			if (!isset($this->lastSpecialEventRegistrationCriteria) || !$this->lastSpecialEventRegistrationCriteria->equals($criteria)) {
				$this->collSpecialEventRegistrations = SpecialEventRegistrationPeer::doSelectJoinRegistration($criteria, $con);
			}
		}
		$this->lastSpecialEventRegistrationCriteria = $criteria;

		return $this->collSpecialEventRegistrations;
	}

} 